import React, {
    Component
} from 'react'
import {
    render
} from 'react-dom'
import {
    Router,
    Route,
    IndexRoute,
    hashHistory
} from 'react-router'

//引用样式
import './Scss/reset.scss'
import './scss/media.px'
import './scss/public.scss'
import './scss/info.scss'

//引入vconsole调试
// import './js/vconsole.js'

//引入组件
const Roots = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Comment/Common/Roots').default)
    }, 'Roots')
}
const Info = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Comment/Info').default)
    }, 'Info')
}
const InfoDetail = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Comment/InfoDetail').default)
    }, 'InfoDetail')
}
const iframe = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Comment/Common/iframe').default)
    }, 'iframe')
}
render((
    <Router history={hashHistory}>
        <Route path='/' getComponent={Roots}>
            <IndexRoute getComponent={Info}/>
                <Route path='Info' getComponent={Info}/>
                <Route path='InfoDetail/:id/:wherefrom(/:sign)' getComponent={InfoDetail}/>
                <Route path='iframe/:sign/:title/:url' getComponent={iframe}/>
        </Route>
    </Router>
), document.getElementById('app'));
